package com.wwl.cms.utils.designModeTest.iterator;

import java.util.Iterator;

/**
 * @author wwl
 * @version 1.0
 * @date 2021/9/9 19:20
 * @description:
 */
public class ComputerCollegeIterator implements Iterator {
    Department[] departments;
    int position = 0;//

    public ComputerCollegeIterator(Department[] departments){
        this.departments = departments;
    }

    @Override
    public boolean hasNext() {
        if (position>=departments.length||departments[position]==null){
            return false;
        }else{
            return true;
        }
    }

    @Override
    public void remove() {

    }

    @Override
    public Object next() {
       Department department = departments[position];
       position+=1;
       return department;
    }
}
